package jp.sourceforge.akjrcp.youtubedl;

import jp.sourceforge.akjrcp.akj_betas.Messages;
import jp.sourceforge.akjrcp.util.YoutubeDLUtils;
import jp.sourceforge.akjrcp.util.YoutubeUtils;

import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.FileFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.eclipse.ui.PlatformUI;

public class YoutubeDLSettingPage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
	public static final String USER="youtubedl.user";
	public static final String PASSWORD="youtubedl.password";
	
	public YoutubeDLSettingPage() {
		super(GRID);
		setPreferenceStore(PlatformUI.getPreferenceStore());
		setDescription(Messages.getString("youtubedl.description")); //$NON-NLS-1$
		initializeDefaults();
	}
	
	private void initializeDefaults() {
		
		// no one call it before open them

	}

	protected void createFieldEditors() {
		
		  FileFieldEditor filefield;
		  
		  filefield=new FileFieldEditor(
				  YoutubeDLUtils.PATH_YOUTUBE_DL_EXE, Messages.getString("youtubedl.path_youtubedl.exe"),getFieldEditorParent()); //$NON-NLS-1$
		  filefield.setFileExtensions(new String[]{"youtube-dl.exe"}); //$NON-NLS-1$
	      addField(filefield);
	      
		  filefield=new FileFieldEditor(
				  YoutubeDLUtils.PATH_PYTHON, Messages.getString("youtubedl.path_python"),getFieldEditorParent()); //$NON-NLS-1$
		  filefield.setFileExtensions(new String[]{"python.exe"}); //$NON-NLS-1$
	      addField(filefield);
	      
	      filefield=new FileFieldEditor(
	    		  YoutubeDLUtils.PATH_YOUTUBE_DL_PY, Messages.getString("youtubedl.path_youtubedl.py"),getFieldEditorParent()); //$NON-NLS-1$
		  filefield.setFileExtensions(new String[]{"youtube-dl.py"}); //$NON-NLS-1$
	      addField(filefield);
	      
	      addField(new YoutubeDLFmtFieldEditor(YoutubeDLUtils.DOWNLOAD_FORMAT,Messages.getString("youtubedl.download_format"),60,getFieldEditorParent()));
	     // addField(new BooleanFieldEditor(YoutubeDLUtils.YOUTUBE_DL_BEST_QUARITY,Messages.getString(YoutubeDLUtils.YOUTUBE_DL_BEST_QUARITY),getFieldEditorParent()));
	}

	public void init(IWorkbench workbench) {
		// TODO Auto-generated method stub
		
	}

}
